home *** CD-ROM | disk | FTP | other *** search
- /* FILE: PHONEBK.H HEADER FILE FOR CAS TOOLKIT PHONEBOOK FUNCTIONS ====
-
- Defines structures and constants used in the Phonebook libraries of the
- Intel/DCA Communicating Applications Specification 1.0 Toolkit.
-
- This file must be included in any application source files that use
- functions from the CAS Toolkit Phonebook libraries.
- ==============================================================================*/
-
- /* PHONEBOOK CONSTANTS */
- #define FNAMELENGTH 13
- #define DIRPATHLENGTH 68
- #define NAMELENGTH 32
- #define PHONENUMLENGTH 47
- #define FULLFNAMELENGTH 80
- #define MAXENTRIES 1000
- #define MAXFIELDSIZE 60
- #define MAXUNUSEDBYTES 32766 /* No, I don't know why this number, see CAS */
- #define FAXONLY 0
- #define HASCCC 1 /*Has Connection Coprocessor or compatable fax board*/
-
- #define SUCCESS 1
- #define FAIL 0
-
- /* PHONEBOOK STRUCTURES AND TYPE DEFINITIONS*/
-
- typedef unsigned char BYTE;
- typedef unsigned short WORD;
- typedef unsigned long LONGWORD;
-
- #pragma pack(1) /* To be image of the diskfile data,*/
- /* these two structs must be packed */
-
- /* PHONEBOOK HEADER STRUCTURE */
- typedef struct {
- WORD id; /* CAS requires: 1ABBH */
- BYTE MajorVersion; /* CCAM Major version number */
- BYTE MinorVersion; /* CCAM Minor version number */
- WORD entries; /* 0 to 1000 */
- WORD FreeBytes; /* unused bytes, 0 to 32766 */
- WORD fields; /* vbl-lngth fields in entries: 0-10 */
- char FieldNames[10][15]; /* names of the above fields */
- } PBH; /* image of the header of the phonebook file on
- disk, except for the 4K array of offsets */
-
- /* PHONEBOOK ENTRY FIXED PART */
- typedef struct {
- int id; /* Record ID is the index to the header's
- entryOffsets array */
- WORD members; /* for individual entries, # of groups
- for group entries, # of members */
- WORD length; /* length of this entry, in bytes */
- BYTE type; /* PERSONENTRY or GROUPENTRY */
- BYTE HardwareType; /* For individuals, individual has fax modem.
- For groups, all members have fax modems. */
- char name[32]; /* cannot be blank, should be unique */
- char PhoneNumber[47]; /* at least 1 digit or M is required
- See manual for legal phone number
- characters and their meanings */
- } PBEFIXED;
-
- #pragma pack()
-
- /* PHONEBOOK STRUCTURE */
- typedef struct {
- PBH header; /* header without the 4K offset array */
- FILE *fp; /* stream pointer for phonebook file */
-
- WORD OBufferSize; /* size of offset cache, 4000 bytes max */
- LONGWORD *OBuffer; /* NULL or array of 1 to 1000 offsets */
- WORD FirstOBufferRID; /* record id of first offset currently in buffer */
- } PB;
-
- /* PHONEBOOK ENTRY USER STRUCTURE */
- typedef struct {
- int id; /* Record ID is the index to the header's
- entryOffsets array */
- WORD members; /* for individual entries, # of groups
- for group entries, # of members */
- WORD length; /* length of this entry, in bytes */
- BYTE type; /* PERSONENTRY or GROUPENTRY */
- BYTE HardwareType; /* For individuals, individual has fax modem.
- For groups, all members have fax modems. */
- char name[32]; /* cannot be blank, should be unique */
- char PhoneNumber[47]; /* at least 1 digit or M is required
- See manual for legal phone number
- characters and their meanings */
- char **fields; /* 0 - 10 60-character strings. */
- int *MemberList; /* list of member or group record id's */
- } PBE;
-
- /* PHONEBOOK GLOBAL VARIABLES */
- extern int Pberrno; /* defined in PBGLOBAL.H */
-
- /*** PHONEBOOK CONSTANTS */
-
- /* CCAM VERSION NUMBERS */
- #define CCAM_Major 1
- #define CCAM_Minor 11
-
- /* PHONEBOOK ENTRY CONSTANTS */
- #define PERSONENTRY 1
- #define GROUPENTRY 2
-
- /* MISCELLANEOUS */
- #define DISKSPACEMARGIN 1024
-
- /* PHONEBOOK ERROR CONSTANTS */
- #define FSEEKERROR 1
- #define OUTOFMEM 2
- #define CANTOPEN 3
- #define CANTWRITE 4
- #define CANTREAD 5
- #define CANTCLOSE 6
- #define ORPHANWARN 7
- #define TOOLONGSTRING 8
- #define FILEALREADYEXISTS 9
- #define FILEDOESNTEXIST 10
- #define OUTOFDISKSPACE 11
- #define INCONSISTENTPBH 12
- #define NOENTRYPRESENT 13
- #define NOENTRYFOUND 14
- #define NOMOREMATCH 15
- #define PHONEBOOKFULL 16
- #define INVALIDENTRY 17
- #define DUPLICATEENTRY 18
- #define FILELENGTHERROR 19
- #define INVALIDCHANGE 20
- #define GROUPNOTEMPTY 21
- #define TOOMANYFREEBYTES 22
- #define GROUPCANTBEMEMBER 23
- #define PERSONCANTHAVEMEMBER 24
- #define ENTRYALREADYMEMBER 25
- #define GROUPDOESNTHAVEMEMBER 26
- #define MEMBERDOESNTHAVEGROUP 27
- #define INVALIDPARAMETER 28
- #define PERSONNOTEMPTY 29
- #define NULLPOINTER 30
- #define LASTMSG 31
-
- /* Phonebook function prototypes */
-
- extern PB * pascal PbCreatePhonebook(PB *pb, char *name);
- extern PB * pascal PbOpenPhonebook(PB *pb, char *name);
- extern PB * pascal PbBufferOffsets(PB *pb, LONGWORD *OBuffer, WORD OBufferSize);
- extern int pascal PbGarbageCollect(char *PbFilename);
-
- extern int pascal PbLookUpSendInfo(PB *pb, char *name, int *recordID, char *PhoneNumber, BYTE *CommHardware);
- extern PBE * pascal PbFindFirstOrNext(PB *pb, PBE *entry, char *name, int *recordID);
- extern PBE * pascal PbGetEntry(PB *pb, PBE *entry, char *name, int RecordID);
- extern void pascal PbFreePBE(PB *pb, PBE *entry);
-
- extern int pascal PbAddEntry(PB *pb, PBE *entry);
- extern int pascal PbModifyEntry(PB *pb, int RecordID, PBE *NewEntry);
- extern int pascal PbRemoveEntry(PB *pb, int RecordID);
- extern int pascal PbAddToGroup(PB *pb, int GroupID, int MemberID);
- extern int pascal PbRemoveFromGroup(PB *pb, int GroupID, int MemberID);
-
- /* Phonebook Library utilities */
- extern PBEFIXED * pascal GetFixedPart(PB *pb, PBEFIXED *ReturnInfo, WORD rid);
- extern char * pascal EntryOkToAdd(PB *pb, PBE *entry);
- extern char * pascal EntryOkToChange(PB *pb, PBE *old_entry, PBE *NewEntry);
- extern LONGWORD pascal OffsetOfEntry(PB *pb, WORD rid);
- extern BYTE pascal HardwareTypeOf(PB *pb, WORD rid, LONGWORD *offset);